package design_patterns;

public class Test {
    public static void main(String[] args) {
//        NewDao dao=SimpleDaoFactory.getInstance("msql");
//        NewsServiceImpl service=new NewsServiceImpl();
//        service.setDao(dao);

//        AbstractFactory factory=new MySqlDaoFactory();  //改变具体工厂可创建不同产品
//        NewDao dao=factory.getInstance();
//        NewsServiceImpl service=new NewsServiceImpl();
//        service.setDao(dao);

//        Buyer buyer=new IntermediaryImpl(new RealBuyer());
//        String result=buyer.havealook();
//        System.out.println(result);

//        RealBuyer buyer=new IntermediarySubclass();
//        String result=buyer.havealook();
//        System.out.println(result);

//        Buyer buyer=IntermediaryJdkProxyFactory.create(new RealBuyer());
//        String result=buyer.havealook();
//        System.out.println(result);

        RealBuyer buyer=IntermediaryCglibProxyFactory.create(RealBuyer.class);
        String result=buyer.havealook();
        System.out.println(result);
    }
}
